package com.lc.aiagent.rag;


import org.springframework.ai.document.Document;
import org.springframework.ai.reader.JsonReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 功能：Json读取器
 * 作者：lc
 * 日期：2025/5/19 17:34
 */
@Component
public class MyJsonReader {

    private final Resource resource;

    public MyJsonReader(@Value("classpath:document/json/*.json") Resource resource) {
        this.resource = resource;
    }

    /**
     * 基本用法
     */
    List<Document>  loadBasicJsonDocuments() {
      return   new JsonReader(resource).get();
    }

}
